<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
	input{
		width: 60px;
		height:30px;
	}
	p{
		width: 160px;
		height:30px;
		text-align: center;
		
	}
	*{
		font-size: 20px;
	}
</style>
<script type="text/javascript">
	var id;
	function start() {
		if(id){
			return;
		}
		id=setInterval(function () {
			var doc=document.getElementById("s");
			var t=new Date();
			console.log(t.toLocaleTimeString());
			doc.innerHTML=t.toLocaleTimeString();
		}, 1000)
	};
	function end() {
		clearInterval(id);	
		id=null;
	}
	
</script>
</head>
<body>
	<p><span id="s"></span></p>
	<p><input type="button" value="开始" onclick="start();"/><input type="button" value="暂停" onclick="end();"/></p>
</body>
</html>